import { createStore } from 'vuex';

const store = createStore({
  state: {
    user: JSON.parse(window.localStorage.getItem('user') || 'null'), // 当前登陆用户状态
  },
  mutations: {
    setUser(state, payload) {
      state.user = JSON.parse(payload);
      window.localStorage.setItem('user', payload);
    },
  },
  actions: {},
});

export default store;
